﻿using Xejen.Ipc.Framework.Flows;
using System;
using System.Collections.Generic;
using System.Text;

namespace Xejen.Ipc.Framework.Controllers
{
    /// <inheritdoc cref="IControllerInstance"/>
    /// <typeparam name="TData"><inheritdoc cref="IFlow{TData}" path="/typeparam[@name='TData']"/></typeparam>
    internal class ControllerInstance<TData> : IControllerInstance
        where TData : new()
    {
        /// <inheritdoc/>
        public string Name { get; set; }

        /// <inheritdoc/>
        public DateTime? CycleStartTime { get; set; }

        /// <inheritdoc/>
        public DateTime? CycleEndTime { get; set; }

        /// <inheritdoc/>
        public TimeSpan? CycleExecutionTime { get; set; }

        /// <inheritdoc cref="ControllerInstance{TData}"/>
        /// <param name="controller"><inheritdoc cref="IController{TData}" path="/summary"/></param>
        public ControllerInstance(IController<TData> controller)
        {
            Check.NotNull(controller, nameof(controller));

            Name = controller.Name;
        }
    }
}
